<?php

	/**
	 * 登记新会员后置操作
	 * 新增会员卡
	 */
	function member_add_before($model){
		
		$addressid = $_POST['addressid'];
		if($addressid){
			$one = M('Site')->find($addressid);
			
			$model->longitude = $one['longitude'];
			$model->latitude  = $one['latitude'];
		}
		
		if($_POST['password']){
			$model->password = myencrypt($_POST['password']);
		}
		
		$model->username = $model->email;
		$model->isreg    = 1;
		
		return $model;
	}
	